Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Add new /content_summary public api #3620

Merged
merged 3 commits into from
Mar 1, 2024
Merged

Conversation

nidhibhatg
Copy link
Collaborator

What changes were proposed in this pull request?

  • Implement a dedicated /content_summary API method tailored for new storage browser.
  • Removed redundant exceptions not relevant to API
  • This separates the old method for existing file browser to not have regressions + much cleaner new method.

How was this patch tested?

  • Manually

Please review Hue Contributing Guide before opening a pull request.

Copy link
Collaborator

@bjornalm bjornalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I just want to hear what @Harshg999 and @JohanAhlen thinks of the _normalize_path before we merge

apps/filebrowser/src/filebrowser/api.py Show resolved Hide resolved
Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost, I've added few review comments

apps/filebrowser/src/filebrowser/api.py Outdated Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Outdated Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Outdated Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Outdated Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Outdated Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Outdated Show resolved Hide resolved
response['summary'] = stats.summary
except WebHdfsException as e:
raise Exception(_('Failed to fetch content summary for "%s". ') % path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should log e (especially e.message)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception (all cascading calls too) will get added in stack trace when the exception occurs. @JohanAhlen - Should we add a better log message separately?

apps/filebrowser/src/filebrowser/api.py Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Show resolved Hide resolved
apps/filebrowser/src/filebrowser/api.py Show resolved Hide resolved
@nidhibhatg nidhibhatg force-pushed the nidhi_summary_api branch 2 times, most recently from 837f63c to adac138 Compare February 22, 2024 06:35
Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting there!

def content_summary(request, path):
path = _normalize_path(path)
response = {'summary': None}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm now thinking we don't need to set it here. What if for all bad cases response is {} but for the good cases we send response = {'summary': summary}. (line 150)

Looks a bit more cleaner to handle in the UI, what do you think?


if not path:
raise Exception(_('Path parameter is required to fetch content summary'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Add . in the end?

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@nidhibhatg nidhibhatg merged commit 55ab28d into master Mar 1, 2024
4 checks passed
@nidhibhatg nidhibhatg deleted the nidhi_summary_api branch March 1, 2024 07:14
athithyaaselvam pushed a commit that referenced this pull request Jun 10, 2024
* [api] Add new /content_summary public api

(cherry picked from commit 55ab28d)
(cherry picked from commit bce57833b09cb018419cb700af9940bd2ea917f6)
Change-Id: I56732633cc044f4750248ee482a8acd2180ac7b3
(cherry picked from commit 84322ed2bf17133db8904f434e195a79f72ee424)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants